from django.contrib.contenttypes.models import ContentType
from django.db import models as models
from django.urls import reverse


class Device(models.Model):

    # Fields
    camera_id = models.CharField(max_length=64)
    created_time = models.DateTimeField(auto_now_add=True, editable=False)
    last_modified = models.DateTimeField(auto_now=True, editable=False)
    comera_name = models.CharField(max_length=64)
    status = models.CharField(max_length=16)


    class Meta:
        ordering = ('-pk',)

    def __unicode__(self):
        return u'%s' % self.pk

    def get_absolute_url(self):
        return reverse('devices_device_detail', args=(self.pk,))


    def get_update_url(self):
        return reverse('devices_device_update', args=(self.pk,))


